@extends('frontend/layouts/default')
@section('title')
Đăng video mới
@stop
@section('content')
<h3 style="text-align: center">
    <span class="glyphicon glyphicon-pencil"></span> Thêm video mới
</h3>
@if(Session::has('success'))
<h3>
    {{Session::get('success')}}
</h3>
@endif
<form class="form-horizontal" action="" method="post" role="form">
    {{ Form::token() }}
    <input type="hidden" name="data[Video][id]" id="data[Video][id]" value="<?= $data['video']->id ?>"/>

    <div class="row">
        <div class="col-md-9">
            <div class="form-group <?= $errors->has('title') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Tiêu đề</label>

                <div class="col-sm-8">
                    <input type="text" name="data[Video][title]" id="data[Video][title]" class="form-control"
                           value="<?= $data['video']->title ?>"/>
                    <?= $errors->first('title', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>
            @if(isset($data['event']))
            <div class="form-group">
                <label class="control-label col-sm-4"></label>
                <div class="col-sm-8">
                    <label class="control-label">
                        Bài dự thi cuộc thi {{$data['event']->title}}
                    </label>
                </div>
            </div>
            @endif

            <div class="form-group <?= $errors->has('embed') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Youtube</label>

                <div class="col-sm-8">
                    <span>
                        http://www.youtube.com/watch?v=<b style="color: red;">xxMr4OfWNT0</b>
                    </span>
                    <input type="text" name="data[Video][youtube]" id="data[Video][youtube]" class="form-control"
                           value="<?= $data['video']->youtube ?>"/>
                    <?= $errors->first('embed', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>
            @if(!empty($data['video']->youtube))
            <div class="form-group <?= $errors->has('embed') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Preview</label>

                <div class="col-sm-8">
                    <iframe width="560" height="315" src="//www.youtube.com/embed/<?=$data['video']->youtube?>" frameborder="0" allowfullscreen></iframe>
                </div>

            </div>
            @endif
            <div class="form-group <?= $errors->has('content') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Nội dung</label>

                <div class="col-sm-8">
                    <textarea name="data[Video][content]" id="textareabox"
                              class="form-control"><?= $data['video']->content ?>
                    </textarea>
                    <?= $errors->first('content', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">Điệu</label>

                <div class="col-sm-8">
                    <?= Form::Select('data[Video][tone_id]', $data['tones'], Input::old('data[Video][tone]', $data['video']->tone_id), array('class' => 'form-control')) ?>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">Chuyên mục</label>

                <div class="col-sm-8">
                    <?= Form::Select('data[Video][category_id]', $data['categories'], Input::old('data[Video][category_id]', $data['video']->category_id), array('class' => 'form-control')) ?>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Chủ đề
                </label>

                <div class="col-sm-8">
                    {{Form::select('data[Topics][]',$data['topics'],array(),array('multiple'=>'multiple','class'=>'form-control'))}}
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Tags
                </label>

                <div class="col-sm-8">
                    <input name="data[Tags]" id="data[Tags]" class="form-control"/>
                    @if(isset($data['tags']))
                    @foreach($data['tags'] as $tag)
                    <a href="javascript:void(0)" class="btn btn-danger btn-xs">{{$tag->title}}</a>&nbsp;
                    @endforeach
                    @endif
                </div>
            </div>
<!--            <div class="form-group">-->
<!--                <label class="control-label col-sm-4">Trạng thái</label>-->
<!---->
<!--                <div class="col-sm-8">-->
<!--                    --><?//= Form::Select('data[Video][status]', Config::get('constants.TEXT_STATUS'), Input::old('data[Video][status]', $data['video']->status), array('class' => 'form-control')) ?>
<!--                </div>-->
<!--            </div>-->
            <div class="controls" align="right">
                <a class="btn btn-link" href="{{ route('video') }}">Hủy</a>
                <button type="submit" class="btn btn-success btn-sm">Lưu</button>
            </div>
        </div>
    </div>
</form>
@stop